import request from '@/utils/request'
const api_name = '/system/user'
export default {
    //用户列表
    getPageList(searchObj) {
        return request({
            //接口路径
            url: `${api_name}/list`,
            method: 'get',
            params: searchObj
        })
    },
    //添加
    save(user) {
        return request({
            //接口路径
            url: `${api_name}/save`,
            method: 'post',
            data: user
        })
    },
    //根据id查询
    getUserById(id) {
        return request({
            //接口路径
            url: `${api_name}/info/${id}`,
            method: 'get',
        })
    },
    //修改
    update(user) {
        return request({
            //接口路径
            url: `${api_name}/update`,
            method: 'post',
            data: user
        })
    },
    //删除
    removeById(id) {
        return request({
            //接口路径
            url: `${api_name}/remove/${id}`,
            method: 'delete',
        })
    },
    //修改状态
    updateStatus(id, status) {
        return request({
            //接口路径
            url: `${api_name}/updateStatus/${id}/${status}`,
            method: 'get',
        })
    },
    //根据用户id查询用户已分配的角色
    getRolesByUserId(userId) {
        return request({
            url: `${api_name}/role/${userId}`,
            method: 'get'
        })
    },

    //分配角色
    assignRoles(assginRoleVo) {
        return request({
            url: `${api_name}/doAssign`,
            method: 'post',
            data: assginRoleVo
        })
    }

}
